package com.financing.platform.dao;

import com.financing.platform.common.Pager;
import com.financing.platform.dto.*;
import com.financing.platform.vo.ProductVO;
import com.financing.platform.vo.ProjectSendConfirmEmailVO;
import com.financing.platform.vo.ProjectSubVO;
import com.financing.platform.vo.ProjectVO;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public interface IProjectDao extends
		IBaseDao  {

	/**
	 * 获取产品列表
	 * @param queryVo
	 * @return
	 */
	public List<ProjectDTO> getProjectList(ProjectDTO projectDTO);

	/**
	 * 根据ID获取产品详情
	 * @param id
	 * @return
	 */
	public ProjectDTO searchProjectByIdOrCode(ProjectDTO projectDTO);
	
	/**
	 * 记录募集进度更新日志
	 * @param id
	 * @return
	 */
	public int addForegroundProductLog(ProjectDTO projectDTO) throws SQLException ;
	
	/**
	 * 更新产品
	 * @param dto
	 * @return id
	 * @throws SQLException 
	 */
	public int updateProject(ProjectDTO projectDTO) throws SQLException;
	
	/**
	 * 更新产品(全字段)
	 * @param dto
	 * @return id
	 * @throws SQLException 
	 */
	public int updateProjectFull(ProjectDTO projectDTO) throws SQLException;
	
	/**
	 * @throws SQLException 
	 * 
	* @Title: addProject 
	* @Description: 添加产品
	* @param   projectDTO
	* @return int   
	* @throws
	 */
	public int addProject(ProjectDTO projectDTO) throws SQLException;
	
	/**
	 * 
	* @Title: autoUpdateSaleStatus 
	* @Description: 自动修改销售时间过期产品的销售状态
	* @param @return    
	* @return int   
	* @throws
	 */
	public int autoUpdateSaleStatus();
	
	/**
	 * 
	* @Title: updateAllSubscription 
	* @Description: 更新产品购买信息
	* @param   projectDTO
	* @param @throws SQLException    
	* @return int   
	* @throws
	 */
	public int updateAllSubscription(ProjectDTO projectDTO) throws SQLException;
	
	/**
	 * 
	* @Title: deleteProject 
	* @Description: 删除产品信息
	* @param   projectId
	* @param @throws SQLException    
	* @return int   
	* @throws
	 */
	public int deleteProject(int projectId)throws SQLException;
	
	/**
	 * 
	* @Title: insertProductAttachment 
	* @Description: 添加产品附件
	* @param   productAttachmentDTO
	* @param @throws SQLException    
	* @return int   
	* @throws
	 */
	public int insertProductAttachment(ProductAttachmentDTO productAttachmentDTO)throws SQLException;
	
	/**
	 * 
	* @Title: deleteProductAttachment 
	* @Description: 删除产品附件表
	* @param   productId
	* @param @throws SQLException    
	* @return int   
	* @throws
	 */
	public int deleteProductAttachment(int productId) throws SQLException;
	
	/**
	 * 
	 * @Title: projectListForPublish
	 * @Description: 查询产品发布列表 
	 * @param @param projectDTO
	 * @param @return
	 * @param @throws SQLException   
	 * @return List<ProjectVO>   
	 * @throws
	 */
	public List<ProjectVO> projectListForPublish(ProjectDTO projectDTO) throws SQLException;
	
	/**
	 * 
	 * @Title: projectListForPublishCount
	 * @Description: 查询产品列表总数 
	 * @param @param projectDTO
	 * @param @return
	 * @param @throws SQLException   
	 * @return int   
	 * @throws
	 */
	public int projectListForPublishCount(ProjectDTO projectDTO) throws SQLException;
	
	/**
	 * 
	 * @Title: queryProductAttachments
	 * @Description: 查询产品附件列表 
	 * @param @param pId
	 * @param @return
	 * @param @throws SQLException   
	 * @return List<ProductAttachmentDTO>   
	 * @throws
	 */
	public List<ProductAttachmentDTO>  queryProductAttachments (Integer pId) throws SQLException;

	/**
	 *
	 * @throws
	 */
	public ProductAttachmentDTO queryProductAttachmentsForId(Integer Id) throws SQLException;

	/**
	 * @Title: queryProjectInfoByIds
	 * @Description: 根号产品数组id，查询产品
	 * @param array
	 * @return
	 */
	public List<ProjectSendConfirmEmailVO> queryProjectInfoByIds(Integer[] array)throws SQLException;
	
	/**
	 * queryProjectInfoByIds  根据数组id 查询waichang产品
	 * @param array
	 * @return
	 * @throws SQLException
	 */
	public List<ProjectSendConfirmEmailVO> queryOutProductInfoByIds(Integer[] array)throws SQLException;
	
	/**获取产品code
	 * @return
	 * @throws SQLException
	 */
	public String queryUUID()  throws SQLException;
	
	/**
	 * @throws SQLException 
	 * 
	* @Title: addProjectExpand 
	* @Description: 添加产品扩展
	* @param   projectDTO
	* @return int   
	* @throws
	 */
	public int addProjectExpand(ProjectExpandDTO projectExpandDTO) throws SQLException;

	/**
	 * 更新产品扩展(全字段)
	 * @param dto
	 * @return id
	 * @throws SQLException 
	 */
	public int updateProjectExpand(ProjectExpandDTO projectExpandDTO) throws SQLException;
	
	/**
	 * 
	 * @Title: selectProjectExpand
	 * @Description: 查询产品扩展是否存在 
	 * @param @param pId
	 * @param @return
	 * @param @throws SQLException   
	 * @return int   
	 * @throws
	 */
	public int selectProjectExpand(Integer pId) throws SQLException;
	
	public List<FpProjectRabate> getProductProfitRebateList(Integer productId) throws SQLException; 
		/**
	 * 插入产品流水
	 * @param projectSubVO
	 * @return
	 * @throws SQLException 
	 */
	public int addProjectFlow(ProjectSubVO projectSubVO) throws SQLException;

	public ProjectDTO searchProjectById(ProjectDTO projectDTO) throws SQLException;
	

	/**
	 * 根据产品名称获取产品详情
	 * @param id
	 * @return
	 * @throws SQLException 
	 */
	public ProjectDTO searchProjectByName(ProjectDTO projectDTO) throws SQLException;
	
	
	/**
	 * 获得产品详情信息
	 * @param productId
	 * @return
	 */
	public ProductDetailPageDTO getProductDetailPage(Integer productId) throws SQLException;
	
	/**
	 * 产品收益信息，
	 * @param id 产品ID
	 * @param sort 排序方式，h：最高收益，l:最低收益
	 * @return
	 */
	public ProductAnnualRevenueDTO queryAnnualRevenue(int id,String sort) throws SQLException;
	
	/**
	 * 产品预约总金额和预约数
	 * productId 产品ID
	 * @return
	 */
	public Map<String,Object> queryProductBuyNumberAndAmount(Integer productId) throws SQLException;

	/**
	 *  渠道- 产品列表 总数
	 * @Title: countProductListForQD
	 * @Description: 查询产品列表
	 * @param @throws SQLException
	 * @return int
	 * @throws
	 */
	public int countProductListForQD(Map<String,Object> queryParams,Pager pager) throws SQLException;


	/**
	 *  渠道- 产品列表
	 * @Title: queryProductListForQD
	 * @Description: 查询产品列表
	 * @param @throws SQLException
	 * @return int
	 * @throws
	 */
	public List<ProductVO> queryProductListForQD(Map<String,Object> queryParams,Pager pager) throws SQLException;

	public List<Map<String,Object>> queryInvestOwner(String investOwnerName) throws SQLException;


	/**
	 *  渠道-查询产品详细
	 * @Title: queryProductQDDetail
	 * @Description: 查询产品详细
	 * @param @throws SQLException
	 * @return int
	 * @throws
	 */
	public ProductVO queryProductQDDetail(Integer pId)throws SQLException;
	/**
	 *  产品名字
	 * @Title: queryPnameByCode
	 * @Description: 根据code查询名称
	 * @param @throws SQLException
	 * @return int
	 * @throws
	 */
	public Map<String, Object> queryPnameByCode(String pCode)throws SQLException;
}
